Skip to content

fix(types): remove void from SharedRenderProps.component union - #4079

Open
ErfanBagheri404 wants to merge 1 commit into
jaredpalmer:mainfrom
ErfanBagheri404:fix/shared-render-props-void-type
Open

fix(types): remove void from SharedRenderProps.component union#4079
ErfanBagheri404 wants to merge 1 commit into
jaredpalmer:mainfrom
ErfanBagheri404:fix/shared-render-props-void-type

Conversation

@ErfanBagheri404

Copy link
Copy Markdown

Summary

SharedRenderProps.component was typed as React.ComponentType<T | void>, but at runtime the component prop always receives the same props as render/children (same object passed to createElement) -- no code path gives it void. The void union forces false type errors when passing a properly-typed React.FC.

Changes

Removed void from the ComponentType union in packages/formik/src/types.tsx.

Type

Type-only change: keyof React.JSX.IntrinsicElements | React.ComponentType, matching render/children.

Closes #4061

The `component` prop always receives the same render props as `render` /
`children` at runtime (same props object passed to `createElement`), so there
is no code path where it gets `void`. The `ComponentType<T | void>` union
forces false type errors when passing a properly-typed `React.FC<T>` component
to `<FieldArray component={...} />` and similar.

Closes jaredpalmer#4061
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@ErfanBagheri404 is attempting to deploy a commit to the Formik Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

鈿狅笍 No Changeset found

Latest commit: a6f44f3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TypeScript] SharedRenderProps.component has incorrect type React.ComponentType<T | void> instead of React.ComponentType<T>

1 participant